package com.qd.panda.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 商品信息
 *
 * @author sjk
 */
@Getter
@Setter
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("panda_product")
public class Product extends Model<Product> implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "product_code", type = IdType.ASSIGN_ID)
    private String productCode;
    /**
     * 名称
     */
    @TableField("name")
    private String name;
    /**
     * 商品单价
     */
    @TableField("price")
    private BigDecimal price;
    /**
     * 库存数量
     */
    @TableField("stock")
    private Integer stock;
    /**
     * 商品封面图片
     */
    @TableField("pic_url")
    private String picUrl;
    /**
     * 上架时间
     */
    @TableField("add_time")
    private LocalDateTime addTime;
    /**
     * 更新时间
     */
    @TableField("update_time")
    private LocalDateTime updateTime;
    /**
     * 商品状态:0上架1下架
     */
    @TableField("state")
    private Integer state;
    /**
     * 厂家
     */
    @TableField("factory")
    private String factory;

    public void freeData() {
        this.productCode = null;
        this.name = null;
        this.price = null;
        this.stock = null;
        this.picUrl = null;
        this.addTime = null;
        this.updateTime = null;
        this.state = null;
        this.factory = null;
    }

}
